﻿<UserControl 
    x:Class="MyFloridaHouse.SilverlightOpenDistricts.MainPage"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  
    xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:m="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl"
    xmlns:local="clr-namespace:MyFloridaHouse.SilverlightOpenDistricts"
    xmlns:customUI="clr-namespace:MyFloridaHouse.libSvUIControls;assembly=libSvUIControls"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"  
    xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"  
    xmlns:commonUtil="clr-namespace:MyFloridaHouse.libSvCommonUtilities.Converters;assembly=libSvCommonUtilities"  
    mc:Ignorable="d" d:DesignWidth="900" d:DesignHeight="480"
    >
    
    <UserControl.Resources>
        <!-- 
            NOTE: All dictionaries are picked up in the App.xaml, including styles here allows us to see the effects in the Visual Studio Designer
            NOTE: The converter staticResources will show up here as "Could not be resolved", but they will be picked up from App.xaml at runtime
        -->
        <ResourceDictionary Source="/libSvCommonUtilities;component/Resources/Styles.xaml"/>
    </UserControl.Resources>
    <!--x:Name="uc_MainPage"-->
    <Grid x:Name="LayoutRoot"  Background="{StaticResource MainPageBackgroundBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0"  Visibility="{Binding isInitializeComplete, Converter={StaticResource ConvertNotBoolToVisibility}}" >
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition Height="auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <StackPanel Grid.Row="0" Orientation="Horizontal">
                <Image Source="Images/Btn_MyDistrictBuilder.jpg"     ></Image>
            </StackPanel>
            <StackPanel Grid.Row="1"  Orientation="Horizontal">
                <dataInput:Label Tag="{Binding}" Content="(CensusGeometry Loading)" Style="{StaticResource LabelStyle}"  Background="Yellow" Visibility="{Binding  censusGeometry.isInitializeComplete, Converter={StaticResource ConvertNotBoolToVisibility}}"  />
                <dataInput:Label Tag="{Binding}" Content="(CensusGeometry Error)" Style="{StaticResource LabelStyle}"  Background="Orange" Visibility="{Binding  censusGeometry.isInitializeError, Converter={StaticResource ConvertVisibilityFromBool}}"  />
                <dataInput:Label Tag="{Binding}" Content="(Plan Types Loading)" Style="{StaticResource LabelStyle}"  Background="Yellow" Visibility="{Binding  districtPlanTypes.isInitializeComplete, Converter={StaticResource ConvertNotBoolToVisibility}}"  />
                <dataInput:Label Tag="{Binding}" Content="(Plan Types  Error)" Style="{StaticResource LabelStyle}"  Background="Orange" Visibility="{Binding  districtPlanTypes.isInitializeError, Converter={StaticResource ConvertVisibilityFromBool}}"  />
                <dataInput:Label Tag="{Binding}" Content="(Layers Loading)" Style="{StaticResource LabelStyle}"  Background="Yellow" Visibility="{Binding isLayersInitializeCompleted, Converter={StaticResource ConvertNotBoolToVisibility}}"  />
                <dataInput:Label Tag="{Binding}" Content="(Layers Error)" Style="{StaticResource LabelStyle}"  Background="Orange" Visibility="{Binding  isLayersInitializeError, Converter={StaticResource ConvertVisibilityFromBool}}"  />
            </StackPanel>
            <StackPanel Grid.Row="2" Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Left"  Margin="10"  >
                <dataInput:Label Tag="{Binding}" Content="(MyDistrictBuilder is Initializing)"  Style="{StaticResource LabelStyle}" FontSize="16" />
                <dataInput:Label Tag="{Binding}" Content="Large Dataset Required:"  Style="{StaticResource LabelStyle}" FontSize="14" />
                <TextBlock Margin ="10" TextWrapping="Wrap" Width="400" 
Text="The application requires a large amount of data to run, 
please be patient while it loads.  It may need as much as a full minute or two the first time you run.  
Be sure and allow us to save the data to your computer's disk.  
Then it should only be about 10 to 15 seconds to start.  
If we have to update the data, the application will have to download it again." />
            </StackPanel>
        </Grid>
        <Grid Grid.Row="0" Background="{StaticResource MainPageBackgroundBrush}" KeyUp="LayoutRoot_KeyUp"  Visibility="{Binding isInitializeComplete, Converter={StaticResource ConvertBoolToVisibility}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <!-- show the status line at the top -->
        <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal">
            <Button Click="btn_Home_Click" ToolTipService.ToolTip="Florida House of Representatives - MyDistrictBuilder" >
                <Button.Content>
                    <Image Source="Images/Btn_MyDistrictBuilder.jpg"     ></Image>
                </Button.Content>
            </Button>
            <StackPanel Orientation="Vertical">
                <StackPanel Orientation="Horizontal">
                    <sdk:Label Style="{StaticResource lblAppTitleStyle}"  Content="(" />
                    <sdk:Label Style="{StaticResource lblAppTitleStyle}"  Content="{Binding districtPlan.districtPlanTypeName}" />
                    <sdk:Label Style="{StaticResource lblAppTitleStyle}"  Content=")" />
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <sdk:Label Style="{StaticResource lblAppTitleStyle}"  Content="(" />
                    <sdk:Label Style="{StaticResource lblAppTitleStyle}"  Content="{Binding districtPlan.districtPlanName}" />
                    <sdk:Label Style="{StaticResource lblAppTitleStyle}"  Content=")" />
                </StackPanel>
            </StackPanel>
            <Border BorderThickness="1">
                <StackPanel Orientation="Vertical">
                    <StackPanel Orientation="Horizontal"  >
                        <dataInput:Label Grid.Row ="2" Grid.Column="0" Content="Click Lat/Long"  Style="{StaticResource lblHeaderStyle}"></dataInput:Label>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal"  >
                            <TextBox  Grid.Row ="2" Grid.Column="1" Width="122" Style="{StaticResource TxtBxLatLonStyle}" Text="{Binding  displayMouseLatLon }"  VerticalAlignment="center"/>
                    </StackPanel>
                </StackPanel>
            </Border>
            <Border BorderThickness="1" VerticalAlignment="Center">
                <StackPanel Orientation="Vertical">
                <StackPanel Orientation="Horizontal"  >
                    <dataInput:Label Content="Zoom:" Style="{StaticResource LabelStyle}"></dataInput:Label>
                    <dataInput:Label x:Name="lbl_ZoomLevel" Width="20" Content="{Binding  ElementName=MyXamlMainMap, Path=ZoomLevel }" Style="{StaticResource LabelStyle}" />
                </StackPanel>
                <StackPanel Orientation="Horizontal"  >
                    <dataInput:Label Content="District:" Style="{StaticResource LabelStyle}"></dataInput:Label>
                    <dataInput:Label Content="{Binding  districtPlan.currentDistrict }" Style="{StaticResource LabelStyle}" />
                </StackPanel>
                    <dataInput:Label x:Name="lbl_findStatus" Content="{Binding findStatus, Mode=OneWay}" Style="{StaticResource LabelStyle}" />
                </StackPanel>
            </Border>
            <Border BorderThickness="1">
                <StackPanel Orientation="Vertical"  >
                        <StackPanel Orientation="Horizontal" Background="Yellow" Visibility="{Binding  serviceDAL.getLayerRegionsShapesInViewRequestActiveCount, Converter={StaticResource ConvertVisibilityFromInt}}" >
                            <dataInput:Label Tag="{Binding}" Content="(Shapes Loading)" Style="{StaticResource LabelStyle}" Height="11" />
                            <dataInput:Label Tag="{Binding}" Content="{Binding  serviceDAL.getLayerRegionsShapesInViewRequestActiveCount}" Style="{StaticResource LabelStyle}" Height="11" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Background="Yellow" Visibility="{Binding  serviceDAL.getLayerRegionsShapesInViewRequestPendingCount, Converter={StaticResource ConvertVisibilityFromInt}}">
                            <dataInput:Label Tag="{Binding}" Content="(Shapes Pending)" Style="{StaticResource LabelStyle}" Height="11" />
                            <dataInput:Label Tag="{Binding}" Content="{Binding  serviceDAL.getLayerRegionsShapesInViewRequestPendingCount}" Style="{StaticResource LabelStyle}" Height="11" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Background="Yellow" Visibility="{Binding  serviceDAL.layerRegionsDataInViewRequestActiveCount, Converter={StaticResource ConvertVisibilityFromInt}}" >
                            <dataInput:Label Tag="{Binding}" Content="(Data Loading)" Style="{StaticResource LabelStyle}" Height="11" />
                            <dataInput:Label Tag="{Binding}" Content="{Binding  serviceDAL.layerRegionsDataInViewRequestActiveCount}" Style="{StaticResource LabelStyle}" Height="11" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Background="Yellow" Visibility="{Binding  serviceDAL.getDistrictDataSummaryRequestCount, Converter={StaticResource ConvertVisibilityFromInt}}" >
                            <dataInput:Label Tag="{Binding}" Content="(Summary Loading)" Style="{StaticResource LabelStyle}" Height="11" />
                            <dataInput:Label Tag="{Binding}" Content="{Binding  serviceDAL.getDistrictDataSummaryRequestCount}" Style="{StaticResource LabelStyle}" Height="11" />
                        </StackPanel>
                    </StackPanel>
            </Border>
                <StackPanel Orientation="Vertical">
                    <StackPanel Orientation="Horizontal">
                        <dataInput:Label Tag="{Binding}" Content="(Building District)" Background="Yellow" Visibility="{Binding serviceDAL.getDistrictShapeRequestCount, Converter={StaticResource ConvertVisibilityFromInt}}" Style="{StaticResource LabelStyle}" Height="15" />
                        <dataInput:Label Tag="{Binding}" Content="{Binding serviceDAL.getDistrictShapeRequestCount}" Background="Yellow" Visibility="{Binding serviceDAL.getDistrictShapeRequestCount, Converter={StaticResource ConvertVisibilityFromInt}}" Style="{StaticResource LabelStyle}" Height="15" />
                    </StackPanel>
                </StackPanel>
                <Border BorderThickness="1" BorderBrush="Black" Background="AntiqueWhite">
                    <StackPanel Orientation="Vertical">
                        <dataInput:Label Content="This site is in development, but the site is functional.  Data is from the 2010 Census!"  Style="{StaticResource LabelStyle}"  />
                        <dataInput:Label Content="To submit a plan click on the 'File' tab and then the submit button."  Style="{StaticResource LabelStyle}"  />
                        <dataInput:Label Content="For more info contact mydistrictbuilder@myfloridahouse.gov"  Style="{StaticResource LabelStyle}"  />
                    </StackPanel>
                </Border>
            </StackPanel>

        <!-- Main Menu and Ribbon Bar-->
        <sdk:TabControl  Grid.Row="1" VerticalAlignment="Top"
				DisplayMemberPath="Content" 
				Background="{StaticResource MainPageBackgroundBrush}"
                BorderThickness="0"
                >
            <sdk:TabItem   >
                <!-- File Menu Ribbon-->
                <sdk:TabItem.Header>
                    <TextBlock Text="File" Margin="19 2 19 0" />
                </sdk:TabItem.Header>
                <sdk:TabItem.Content>
                        <StackPanel Orientation="Horizontal">
                            <Button Content="New"     Command="{Binding CmdFileNew}"  ></Button>
                            <Button Content="Save"  Command="{Binding CmdFileExport}" ></Button>
                            <Button Content="Open"  Command="{Binding CmdFileImport}" ></Button>
                            <Button Content="Open System Plan"  Command="{Binding CmdFileImportCloud}" ></Button>
                            <Button Content="Submit"  Command="{Binding CmdFileSubmit}" ></Button>
                            <!--<Button Content="Save As" Command="{Binding CmdFileSaveAs}" ></Button>-->
                            <Button Content="Print"   Command="{Binding CmdFilePrint}" ></Button>
                        </StackPanel>
                    </sdk:TabItem.Content>

            </sdk:TabItem>

            <sdk:TabItem  Visibility="{Binding districtPlan.districtCount, Converter={StaticResource ConvertVisibilityFromInt}}" >
                <!-- Build Menu Ribbon-->
                <sdk:TabItem.Header>
                    <TextBlock Text="Build" Margin="19 2 19 0" />
                </sdk:TabItem.Header>
                <sdk:TabItem.Content>
                    <StackPanel Orientation="Horizontal"   Background="{Binding districtSelectedFillColorBrush }">

                        <Border BorderThickness="1" BorderBrush="{Binding districtPlan.isShowDistrictRibbonSelected, Converter={StaticResource ConvertBoolToLockedBrush}}">
                            <ToggleButton IsThreeState="False" IsChecked="{Binding districtPlan.isShowDistrictRibbonSelected, Mode=TwoWay}" Content="D" ToolTipService.ToolTip="Show/Hide Districts Ribbon" Margin="2"/>
                        </Border>
                        <Border BorderThickness="1" BorderBrush="{Binding districtPlan.isShowDistrictStragglerRibbonSelected, Converter={StaticResource ConvertBoolToLockedBrush}}">
                                <ToggleButton IsThreeState="False" IsChecked="{Binding districtPlan.isShowDistrictStragglerRibbonSelected, Mode=TwoWay}" Content="S"  ToolTipService.ToolTip="Show/Hide Straggler Ribbon" Margin="2"/>
                        </Border>

                        <sdk:Label Content="  |  "/>
                        <Border >
                            <StackPanel Orientation="Horizontal">
                                <Button Content="Cut"      Command="{Binding CmdBuildCut}"  ToolTipService.ToolTip="Remove current district from map, save a copy in MyDistrictBuilder clipboard" ></Button>
                                <Button Content="Copy"     Command="{Binding CmdBuildCopy}"   ToolTipService.ToolTip="Save a copy of current district in MyDistrictBuilder clipboard"  ></Button>
                                <Button Content="Paste"    Command="{Binding CmdBuildPaste}"    ToolTipService.ToolTip="Paste contents of MyDistrictBuilder clipboard to the currently selected district" ></Button>
                                <ToggleButton Margin="2" Command="{Binding CmdBuildLockDistrictAll}"  ToolTipService.ToolTip="Lock/Unlock all Districts">
                                    <ToggleButton.Content>
                                        <StackPanel Orientation="Vertical">
                                            <sdk:Label Content="Lock" />
                                            <sdk:Label Content="All" />
                                        </StackPanel>
                                    </ToggleButton.Content>
                                </ToggleButton>
                                    
                                <ToggleButton Margin="2" Height="20" Content="Lock" Command="{Binding CmdBuildLockDistrict}" ToolTipService.ToolTip="Lock/Unlock current District"></ToggleButton>
                                <ComboBox  Height="20"  x:Name="cmbDistrict" ItemsSource="{Binding districtPlan.districtList}" SelectedIndex="{Binding districtPlan.districtSelectedIndex, Mode=TwoWay}" Tag="{Binding}"  >
                                    <ComboBox.ItemTemplate>
                                        <DataTemplate>
                                            <Border HorizontalAlignment="Stretch"  Background="{Binding fillColorBrush}">
                                            <sdk:Label Content="{Binding displayName}" Width="50" />
                                            </Border>
                                        </DataTemplate>
                                    </ComboBox.ItemTemplate>
                                </ComboBox>


                                </StackPanel>
                        </Border>

                            <Border  Background="{Binding isSelectedBuildLayerHidden, Converter={StaticResource ConvertIndicatorBrushFromBool}, ConverterParameter=WARNING}">
                            <StackPanel Orientation="Horizontal" ToolTipService.ToolTip="Background will show different background when selection is not shown on map, you will build with selection, not items shown on map">
                                <dataInput:Label   Content="Build With " Style="{StaticResource lblDataStyle}"/>
                                <ComboBox Height="20"  ItemsSource="{Binding buildLayerList}" SelectedIndex="{Binding buildLayerListSelectedIndex, Mode=TwoWay}"  DisplayMemberPath="layerName" Tag="{Binding}" />
                            </StackPanel>
                        </Border>

                        <Border Style="{StaticResource BuildTypeRadioButtonBorder}">
                            <StackPanel Orientation="Horizontal" ToolTipService.ToolTip="No district building possible in this mode, allows you to look around map without affecting districts">
                                <RadioButton Style="{StaticResource BuildTypeRadioButton}" IsChecked="{Binding mapMode, Mode=TwoWay, Converter={StaticResource ConvertEnumToBool}, ConverterParameter=Explore}" />
                                <TextBlock  Style="{StaticResource BuildTypeRadioButtonText}" Text="Explore" />
                            </StackPanel>
                        </Border>

                        <Border Style="{StaticResource BuildTypeRadioButtonBorder}">
                            <StackPanel Orientation="Horizontal"  ToolTipService.ToolTip="Single click mode, allows you to add a single geography (the type shown in the 'Build With' combo box) to the current district">
                                <RadioButton  Style="{StaticResource BuildTypeRadioButton}" IsChecked="{Binding mapMode, Mode=TwoWay, Converter={StaticResource ConvertEnumToBool}, ConverterParameter=Click}" />
                                <TextBlock  Style="{StaticResource BuildTypeRadioButtonText}" Text="Assign" />
                            </StackPanel>
                        </Border>


                        <Border Style="{StaticResource BuildTypeRadioButtonBorder}">
                            <StackPanel Orientation="Horizontal"  ToolTipService.ToolTip="Lasso click mode, allows you to add a group of geographies (the type shown in the 'Build With' combo box) to the current district.  Double Click to end, Click Explore to cancel.">
                                <RadioButton Style="{StaticResource BuildTypeRadioButton}"  IsChecked="{Binding mapMode, Mode=TwoWay, Converter={StaticResource ConvertEnumToBool}, ConverterParameter=Lasso}" />
                                <TextBlock  Style="{StaticResource BuildTypeRadioButtonText}" Text="Lasso" />
                            </StackPanel>
                        </Border>

                        <Button Content="Undo"     Command="{Binding CmdBuildUndo}" ToolTipService.ToolTip="Undo Last Assignment"  ></Button>
                        <Button Content="Redo"     Command="{Binding CmdBuildRedo}" ToolTipService.ToolTip="Redo Last Assignment (can be to different district) "  ></Button>
                        <Button Command="{Binding CmdBuildShaded}" ToolTipService.ToolTip="Add shaded areas to current District"  >
                            <Button.Content>
                                <StackPanel Orientation="Vertical">
                                    <sdk:Label FontSize="9" Content="Build" />
                                    <sdk:Label FontSize="9"  Content="Shaded" />
                                </StackPanel>
                            </Button.Content>
                        </Button>
                        

                    </StackPanel>
                </sdk:TabItem.Content>
            </sdk:TabItem>

            <!-- Configure-->
            <!--<sdk:TabItem Visibility="{Binding districtCount, Converter={StaticResource ConvertVisibilityFromInt}}">
                <sdk:TabItem.Header>
                    <TextBlock Text="Configure" Margin="19 2 19 0" />
                </sdk:TabItem.Header>
                <sdk:TabItem.Content>
                    <StackPanel Orientation="Horizontal">

                        <Button Content="District"   Command="{Binding CmdDistrictConfig}"   ></Button>
                        <Button Margin="2" Height="20" Content="Layers" Command="{Binding CmdConfig}"  ></Button>
                    </StackPanel>
                </sdk:TabItem.Content>
            </sdk:TabItem>-->

            <!-- Data -->
            <!--<sdk:TabItem Visibility="{Binding districtCount, Converter={StaticResource ConvertVisibilityFromInt}}">
                <sdk:TabItem.Header>
                    <TextBlock Text="Data" Margin="19 2 19 0" />
                </sdk:TabItem.Header>
                <sdk:TabItem.Content>
                    <StackPanel Orientation="Horizontal">

                        <dataInput:Label   Content="TBD " Style="{StaticResource lblDataStyle}"/>
                    </StackPanel>
                </sdk:TabItem.Content>
            </sdk:TabItem>-->

            <!-- Reports Menu Ribbon-->
            <!--<sdk:TabItem Visibility="{Binding districtCount, Converter={StaticResource ConvertVisibilityFromInt}}">
                <sdk:TabItem.Header>
                    <TextBlock Text="Reports" Margin="19 2 19 0" />
                </sdk:TabItem.Header>
                <sdk:TabItem.Content>
                    <StackPanel Orientation="Horizontal">

                        <dataInput:Label   Content="TBD " Style="{StaticResource lblDataStyle}"/>
                    </StackPanel>
                </sdk:TabItem.Content>
            </sdk:TabItem>-->

            <!-- Tools Menu Ribbon-->
            <!--<sdk:TabItem Visibility="{Binding districtCount, Converter={StaticResource ConvertVisibilityFromInt}}">
                <sdk:TabItem.Header>
                    <TextBlock Text="Tools" Margin="19 2 19 0" />
                </sdk:TabItem.Header>
                <sdk:TabItem.Content>
                    <StackPanel Orientation="Horizontal">

                        <Button Content="Find" Click="btn_FindPopup_Click"   ></Button>
                        <Button Margin="2" Height="20" Content="Distance" Command="{Binding CmdToolsDistance}"  ></Button>
                        <dataInput:Label   Content="    |   " Style="{StaticResource lblDataStyle}"/>
                        <Button Content="Renumber" ToolTipService.ToolTip="Not available yet" Command="{Binding CmdDistrictRenumber}"   ></Button>
                        <Button Content="Stragglers" ToolTipService.ToolTip="Not available yet" Command="{Binding CmdToolsGetNonContiguousDistricts}"   ></Button>
                        <Button Content="Holes" ToolTipService.ToolTip="Not available yet" Command="{Binding CmdToolsGetDistrictHoles}"   ></Button>

                        <dataInput:Label   Content="    |   " Style="{StaticResource lblDataStyle}"/>
                        <Button Content="Orphans" Command="{Binding CmdToolsGetUnassignedRegions}"   ></Button>
                    </StackPanel>
                </sdk:TabItem.Content>
            </sdk:TabItem>-->

                <sdk:TabItem  >
                    <!-- View Menu Ribbon-->
                    <sdk:TabItem.Header>
                        <TextBlock Text="View" Margin="19 2 19 0" />
                    </sdk:TabItem.Header>
                    <sdk:TabItem.Content>
                        <StackPanel Orientation="Horizontal">
                            <Border BorderThickness="1">
                                <StackPanel Orientation="Horizontal">
                                    <Button x:Name="btn_FullScreen" Content="Full Screen"   Click="btn_GoToFullScreen_Click" ></Button>
                                    <Button x:Name="btn_ToggleShowBing"     Height="20" Content="{Binding bingCommandLabel}"     Command="{Binding CmdToggleShowBing}"></Button>
                                </StackPanel>
                            </Border>

                            <!--<Border BorderThickness="1" Visibility="{Binding districtCount, Converter={StaticResource ConvertVisibilityFromInt}}">
                            <StackPanel Orientation="Horizontal">

                                <ComboBox Height="20" />
                                <Button Content="Full" Command="{Binding CmdViewFull}" ></Button>
                                <Button Content="Prev" Command="{Binding CmdViewPrev}" ></Button>
                                <Button Content="Next" Command="{Binding CmdViewNext}" ></Button>
                            </StackPanel>
                        </Border>-->
                        </StackPanel>
                    </sdk:TabItem.Content>

                </sdk:TabItem>


                <sdk:TabItem  >
                    <!-- Preferences Menu Ribbon-->
                    <sdk:TabItem.Header>
                        <TextBlock Text="Preferences" Margin="19 2 19 0" />
                    </sdk:TabItem.Header>
                    <sdk:TabItem.Content>
                        <Border BorderThickness="1">
                            <StackPanel Orientation="Horizontal">
                                <Button Content="District"      Command="{Binding CmdPrefDistrict}"  ToolTipService.ToolTip="Customize District Setup" ></Button>
                                <Button Content="Data"      Command="{Binding CmdPrefCriteria}"  ToolTipService.ToolTip="Customize Criteria Setup" ></Button>
                            </StackPanel>
                        </Border>
                    </sdk:TabItem.Content>

                </sdk:TabItem>

                <sdk:TabItem >
                <!-- Help Menu Ribbon-->
                <sdk:TabItem.Header>
                    <TextBlock Text="Help" Margin="19 2 19 0" />
                </sdk:TabItem.Header>
                <sdk:TabItem.Content>
                    <StackPanel Orientation="Horizontal">
                        <Button Content="About"  Command="{Binding CmdHelpAbout}"   />
                        <Button Content="Quick Start"  Click="btn_HelpQuickStart_Click"   />
                        <Button Content="Tutorial"   Click="btn_HelpTutorial_Click"     />
                        <Button Content="Tutorial Videos"   Click="btn_HelpTutorialVideos_Click"     />
                        <Button Content="Glossary"   Click="btn_HelpGlossary_Click"     />
                    </StackPanel>
                </sdk:TabItem.Content>
            </sdk:TabItem>

            <sdk:TabItem >
                <!-- Help Menu Ribbon-->
                <sdk:TabItem.Header>
                    <TextBlock Text="Contact Us" Margin="19 2 19 0" />
                </sdk:TabItem.Header>
                <sdk:TabItem.Content>
                    <StackPanel Orientation="Horizontal">
                        <Button Click="btn_Email_Click" ToolTipService.ToolTip="Send email to mydistrictbuilder@myfloridahouse.gov" >
                            <Button.Content>
                                <Image Source="Images/Btn_Email.jpg"     ></Image>
                            </Button.Content>
                        </Button>
                        <Button Click="btn_Facebook_Click" ToolTipService.ToolTip="Go to the myDistrictBuilder facebook page" >
                            <Button.Content>
                                <Image Source="Images/Btn_Facebook.jpg"     ></Image>
                            </Button.Content>
                        </Button>
                        <Button Click="btn_Twitter_Click" ToolTipService.ToolTip="Go to the myDistrictBuilder twitter page" >
                        <Button.Content>
                            <Image Source="Images/Btn_Twitter.jpg"     ></Image>
                        </Button.Content>
                    </Button>
                    <Button Click="btn_YouTube_Click" ToolTipService.ToolTip="Go to the myDistrictBuilder YouTube channel" >
                        <Button.Content>
                            <Image Source="Images/Btn_YouTube.jpg"     ></Image>
                        </Button.Content>
                    </Button>
                    </StackPanel>
                </sdk:TabItem.Content>
            </sdk:TabItem>


            <sdk:TabItem >
                <!-- Report Menu Ribbon-->
                <sdk:TabItem.Header>
                    <TextBlock Text="Reports" Margin="19 2 19 0" />
                </sdk:TabItem.Header>
                <sdk:TabItem.Content>
                    <StackPanel Orientation="Horizontal">
                        <Button IsEnabled="False" Click="btn_MassDataReport_Click" Content="Mass Data Report Generator"  />
                    </StackPanel>
                </sdk:TabItem.Content>
            </sdk:TabItem>
        </sdk:TabControl>


        <!-- District Ribbon -->
            <Grid Grid.Row="2" Background="{StaticResource MainPageBackgroundBrush}"   Visibility="{Binding districtPlan.isDistrictRibbonVisible, Converter={StaticResource ConvertBoolToVisibility}}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Button  Grid.Row="0" Grid.Column="0" Content="Unassigned" Command="{Binding CmdBuildTargetUnassigned}"  Height="25"  ToolTipService.ToolTip="Shortcut to set the target district to 'Unassigned'" />
                <ListBox   Grid.Row="0" Grid.Column="1" Margin="0"  
                  ItemsSource="{Binding districtPlan.districtList}" 
                  ScrollViewer.HorizontalScrollBarVisibility="Auto" 
                  Background="{StaticResource MainPageBackgroundBrush}" 
                  >
                
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"></StackPanel>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <!-- 
                                    Using a staticResource based data template that has a wrap panel for an itemsPanel causes a runtime error, so can't move this data template to resources 
                                    example of where someone else had the same problem - no solution, look after the answer: http://forums.silverlight.net/forums/p/119052/268300.aspx
                                -->
                <ListBox.ItemTemplate>
                    <DataTemplate  >
                        <Border BorderThickness="1" BorderBrush="{Binding isLocked, Converter={StaticResource ConvertBoolToLockedBrush}}"  Background="{Binding isSelected, Converter={StaticResource ConvertBoolToSelectedBrush}}"
                                 Padding="3"                >
                            <Button x:Name="btn_DistrictSelect"  Width="25" Click="btn_DistrictSelect_Click"  Tag="{Binding}" ToolTipService.ToolTip="Click here to select a district" >
                                <Button.Content >
                                    <Border Width="25" Background="{Binding fillColorBrush}">
                                        <StackPanel Orientation="Horizontal">
                                            <dataInput:Label Content="{Binding displayName}" Style="{StaticResource LabelStyle}"  ></dataInput:Label>
                                        <StackPanel Orientation="Vertical">
                                            <Ellipse Height="6" Width="6" Fill="Black" Visibility="{Binding isContiguous, Converter={StaticResource ConvertNotBoolToVisibility}}" VerticalAlignment="Top" ></Ellipse>
                                            <Rectangle Height="6" Width="6" Fill="Red" Visibility="{Binding hasHole, Converter={StaticResource ConvertBoolToVisibility}}" VerticalAlignment="Bottom" ></Rectangle>
                                        </StackPanel>
                                    </StackPanel>
                                    </Border>
                                </Button.Content>
                            </Button>
                        </Border>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
            </Grid>

            <!-- District Straggler Ribbon -->
        <Grid Grid.Row="3" Grid.Column="0" Visibility="{Binding districtPlan.isDistrictStragglerRibbonVisible, Converter={StaticResource ConvertBoolToVisibility}}">
            <Grid.RowDefinitions>
                <RowDefinition Height="50" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="35" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
 <!----> 
            <Button Grid.Column="0" x:Name="btn_DistrictExtent" Click="btn_DistrictExtent_Click" Tag="{Binding districtPlan.selectedDistrict}"
                   ScrollViewer.HorizontalScrollBarVisibility="Hidden" 
                    ScrollViewer.VerticalScrollBarVisibility="Hidden" 
                    Visibility="{Binding districtPlan.isDistrictExtentVisible, Converter={StaticResource ConvertBoolToVisibility}}">
                <Button.Content>
                    <Image Source="Images/IconDistrictSolid.jpg" Stretch="None" ToolTipService.ToolTip="Zoom to entire selected district"></Image>
                </Button.Content>
            </Button>
            <ListBox  Grid.Column="1"     
                      ItemsSource="{Binding districtPlan.selectedDistrictSubShapeList}"  
                      ScrollViewer.HorizontalScrollBarVisibility="Visible" 
                       ScrollViewer.VerticalScrollBarVisibility="Hidden"
                      Background="{StaticResource MainPageBackgroundBrush}">
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"></StackPanel>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemTemplate>
                    <DataTemplate  >
                        <Border BorderThickness="1" BorderBrush="Black"> 
                            <Button x:Name="btn_DistrictStraggler" Click="btn_DistrictSubshape_Click" Tag="{Binding}" ToolTipService.ToolTip="Zoom to district straggler.  NOTE: Some Stragglers are too small to see and are a result of the shapebuilding software library we are using. We hope to remove them in the future.">
                                <Button.Content>
                                    <Image Source="Images/IconDistrictStraggler.jpg" Stretch="None"></Image>
                                </Button.Content>
                            </Button>
                        </Border>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

                     <!--Visibility="{Binding isDistrictStragglerRibbonVisible, Converter={StaticResource ConvertBoolToVisibility}}"-->
            <ListBox   Grid.Column="2"    
                      HorizontalAlignment="Stretch"
                      ItemsSource="{Binding districtPlan.selectedDistrictHoleList}"  
                      ScrollViewer.HorizontalScrollBarVisibility="Visible" 
                       ScrollViewer.VerticalScrollBarVisibility="Hidden"
                      Background="{StaticResource MainPageBackgroundBrush}" 
                                     >
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"></StackPanel>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>

                <ListBox.ItemTemplate>
                    <DataTemplate  >
                        <Border BorderThickness="1" BorderBrush="Black"><!--Content="{Binding uriString, Converter={StaticResource ConvertImageFromUriString}}"-->  
                            <Button x:Name="btn_DistrictStraggler" Click="btn_DistrictSubshape_Click" Tag="{Binding}"  >
                                <Button.Content>
                                    <Image Source="Images/IconDistrictHole.jpg" Stretch="Fill" ToolTipService.ToolTip="Zoom to hole in district"/>
                                </Button.Content>
                            </Button>
                        </Border>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        
        </Grid>
        
        <Grid x:Name="ApplicationMapSpace"  Grid.Row="4"   >
            <Grid.RowDefinitions>
                <RowDefinition Height="*" MinHeight="5" />
                <RowDefinition Height="2" />
                <RowDefinition Height="150" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="200"/>
                <ColumnDefinition Width="2"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="2"/>
                <ColumnDefinition Width="150"/>
            </Grid.ColumnDefinitions>

            <Grid x:Name="LeftMenuGrid" Grid.Column="0"  Visibility="{Binding isLeftMenuVisible, Converter={StaticResource ConvertBoolToVisibility}}" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid Grid.Row="0" >
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto" />
                        <RowDefinition Height="auto" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <StackPanel Orientation="Horizontal"  Grid.Row="0" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                        <dataInput:Label Grid.Row="0" Grid.Column="1" Content="Show"        HorizontalAlignment="Center"></dataInput:Label>
                        <!--<dataInput:Label Grid.Row="0" Grid.Column="1" Content="/Fill/"        HorizontalAlignment="Center"></dataInput:Label>
                        <dataInput:Label Grid.Row="0" Grid.Column="2" Content="Border  "  HorizontalAlignment="Center" ></dataInput:Label>-->
                    </StackPanel>

                    <StackPanel Grid.Row="1" Grid.Column="0"  Orientation="Horizontal" HorizontalAlignment="Left" >

                        <CheckBox HorizontalAlignment="Center" Tag="{Binding}" IsChecked="{Binding isDistrictLayerVisible, Mode=TwoWay}" Margin="2" VerticalAlignment="Center"   ToolTipService.ToolTip="Show/Hide Districts on the map"/>
                        <!-- //TODO: This is bad, shouldn't be putting -1 hardcoded for district layer -->
                        <!--<RadioButton  IsChecked="{Binding layerIDForShading, Mode=TwoWay, Converter={StaticResource ConvertLayerIDToBool}, ConverterParameter=-1}" />
                        <CheckBox HorizontalAlignment="Center" Tag="{Binding}" IsChecked="{Binding isDistrictBorderVisible, Mode=TwoWay}" Margin="2" VerticalAlignment="Center" />-->
                        <dataInput:Label Grid.Row="0" Grid.Column="2" Content="District  "  HorizontalAlignment="Center" ></dataInput:Label>
                    </StackPanel>

                </Grid>
                    <Grid Grid.Row="1" Grid.Column="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                            <Grid Grid.Row="0" Background="{StaticResource MainPageBackgroundBrush}" >
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="auto" />
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>

                                <StackPanel Orientation="Horizontal"  Grid.Row="0" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Grid.Row="0" Grid.Column="1" Content="Show/"        HorizontalAlignment="Center"></dataInput:Label>
                            <dataInput:Label Grid.Row="0" Grid.Column="1" Content="Fill/"        HorizontalAlignment="Center"></dataInput:Label>
                            <dataInput:Label Grid.Row="0" Grid.Column="2" Content="Zoom Range / "  HorizontalAlignment="Center" ></dataInput:Label>
                                        <dataInput:Label Grid.Row="0" Grid.Column="3" Content="Layer Name"  HorizontalAlignment="Center"></dataInput:Label>
                                </StackPanel>


                                <ListBox  Grid.Row="1" Grid.Column="0" 
                                      ItemsSource="{Binding mapLayerList}" Margin="0,0,0,0"   
                                      ItemTemplate="{StaticResource DataTemplateLayerSelection}"
                                      Background="{StaticResource MainPageBackgroundBrush}" >
                                    <ListBox.ItemsPanel  >
                                        <ItemsPanelTemplate>
                                            <StackPanel Orientation="Vertical" Background="{StaticResource MainPageBackgroundBrush}"></StackPanel>
                                        </ItemsPanelTemplate>
                                    </ListBox.ItemsPanel>
                                </ListBox>
                            </Grid>

                    <controls:GridSplitter x:Name="LeftMenuGridlSplitter" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Background="Blue" Height="4" ToolTipService.ToolTip="Drag to adjust Layer Control/Data Display size"></controls:GridSplitter>

                    <ListBox Grid.Row="2" x:Name="lbx_RegionDataList"  Margin="0"  
                                 Background="LightBlue" 
                                 ItemTemplate="{StaticResource DataTemplateMenuRegionData}" >
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Background="{Binding  Path=isFreezeData, Converter={StaticResource ConvertActiveBrushFromBool}}"  />
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>
                            </ListBox>
                </Grid>
            </Grid>
                <!--<layoutToolkit:Accordion Grid.Column="0" VerticalAlignment="Top" SelectionMode="ZeroOrMore"  SelectionSequence="Simultaneous">

                    <layoutToolkit:AccordionItem Header="Layers"  Style="{StaticResource MenuItemStyle}" IsSelected="False"  >
                        <layoutToolkit:AccordionItem.Content>-->
                <!--</layoutToolkit:AccordionItem.Content>
                    </layoutToolkit:AccordionItem>

                    <layoutToolkit:AccordionItem Header="Data"  Style="{StaticResource MenuItemStyle}" IsSelected="False"  >
                        <layoutToolkit:AccordionItem.Content>-->
                <!--</layoutToolkit:AccordionItem.Content>
                    </layoutToolkit:AccordionItem>-->
                <!--<layoutToolkit:AccordionItem Header="Map Stats"  Style="{StaticResource MenuItemStyle}" IsSelected="False"   >
                        <layoutToolkit:AccordionItem.Content>
                            <Grid Background="{StaticResource MainPageBackgroundBrush}">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="auto" />
                                    <RowDefinition Height="auto" />
                                    <RowDefinition Height="auto" />
                                    <RowDefinition Height="auto" />
                                    <RowDefinition Height="auto" />
                                    <RowDefinition Height="auto" />
                                    <RowDefinition Height="auto" />
                                    <RowDefinition Height="auto" />
                                    <RowDefinition Height="auto" />
                                    <RowDefinition Height="auto" />
                                    <RowDefinition Height="auto" />
                                    <RowDefinition Height="auto" />
                                    <RowDefinition Height="auto" />
                                    <RowDefinition Height="auto" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="auto" />
                                    <ColumnDefinition Width="auto" />
                                    <ColumnDefinition Width="auto" />
                                    <ColumnDefinition Width="auto" />
                                    <ColumnDefinition Width="auto" />
                                    <ColumnDefinition Width="auto" />
                                    <ColumnDefinition Width="auto" />
                                    <ColumnDefinition Width="auto" />
                                    <ColumnDefinition Width="auto" />
                                    <ColumnDefinition Width="auto" />
                                </Grid.ColumnDefinitions>

                                <dataInput:Label Grid.Row ="0" Grid.Column="0" Grid.ColumnSpan="9"  Content="Map Dims" Style="{StaticResource lblHeaderStyle}"/>

                                <dataInput:Label Grid.Row ="1" Grid.Column="1" Content="Lat"  Style="{StaticResource LabelStyle}"></dataInput:Label>
                                <dataInput:Label Grid.Row ="1" Grid.Column="2" Content="   "  Style="{StaticResource LabelStyle}"></dataInput:Label>
                                <dataInput:Label Grid.Row ="1" Grid.Column="3" Content="Lon"  Style="{StaticResource LabelStyle}"></dataInput:Label>

                                <dataInput:Label Grid.Row ="2" Grid.Column="0" Content="Click"  Style="{StaticResource lblHeaderStyle}"></dataInput:Label>
                                <TextBox         Grid.Row ="2" Grid.Column="1" Text="{Binding  mapMouseLatLon.Latitude }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>
                                <TextBox         Grid.Row ="2" Grid.Column="3" Text="{Binding  mapMouseLatLon.Longitude }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>

                                <dataInput:Label Grid.Row ="3" Grid.Column="0"   Content="NW" Style="{StaticResource lblHeaderStyle}"/>
                                <TextBox         Grid.Row ="3" Grid.Column="1" Text="{Binding  mapLatLonNW.Latitude }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>
                                <TextBox         Grid.Row ="3" Grid.Column="3" Text="{Binding  mapLatLonNW.Longitude }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>

                                <dataInput:Label Grid.Row ="4" Grid.Column="0"   Content="SE" Style="{StaticResource lblHeaderStyle}"/>
                                <TextBox         Grid.Row ="4" Grid.Column="1" Text="{Binding  mapLatLonSE.Latitude }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>
                                <TextBox         Grid.Row ="4" Grid.Column="3" Text="{Binding  mapLatLonSE.Longitude }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>

                                <dataInput:Label Grid.Row ="5" Grid.Column="1" Content="X"  Style="{StaticResource LabelStyle}"></dataInput:Label>
                                <dataInput:Label Grid.Row ="5" Grid.Column="3" Content="Y"  Style="{StaticResource LabelStyle}"></dataInput:Label>

                                <dataInput:Label Grid.Row ="6" Grid.Column="0"   Content="NW" Style="{StaticResource lblHeaderStyle}"/>
                                <TextBox         Grid.Row ="6" Grid.Column="1" Text="{Binding  mapViewPortNW.Y }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>
                                <TextBox         Grid.Row ="6" Grid.Column="3" Text="{Binding  mapViewPortNW.X }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>


                                <dataInput:Label Grid.Row ="8" Grid.Column="0"   Content="SE" Style="{StaticResource lblHeaderStyle}"/>
                                <TextBox         Grid.Row ="8" Grid.Column="1" Text="{Binding  mapViewPortSE.Y }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>
                                <TextBox         Grid.Row ="8" Grid.Column="3" Text="{Binding  mapViewPortSE.X }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>

                                <dataInput:Label Grid.Row ="10" Grid.Column="0"  Grid.ColumnSpan="5" Content="L/L per X/Y" Style="{StaticResource lblHeaderStyle}"/>
                                <TextBox         Grid.Row ="11" Grid.Column="1" Text="{Binding  mapLatitudePerPixel }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>
                                <TextBox         Grid.Row ="11" Grid.Column="3" Text="{Binding  mapLongitudePerPixel }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>

                                <StackPanel Grid.Row="12" Grid.Column="0" Grid.ColumnSpan="4" Orientation="Vertical" HorizontalAlignment="Left" Margin="0,2,2,2" >
                                    <StackPanel Orientation="Horizontal">
                                    </StackPanel>
                                </StackPanel>

                            </Grid>
                        </layoutToolkit:AccordionItem.Content>
                    </layoutToolkit:AccordionItem>-->


                    <!--<layoutToolkit:AccordionItem Header="Configure Districts"  Style="{StaticResource MenuItemStyle}" IsSelected="False"   Visibility="{Binding districtCount, Converter={StaticResource ConvertVisibilityFromInt}}" >
                        <layoutToolkit:AccordionItem.Content>
                            <StackPanel Orientation="Vertical">-->
                                <!--<CheckBox Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" Tag="{Binding}" IsChecked="{Binding showFill, Mode=TwoWay}"  Content="Fill" Click="chkBx_lbx_layerConfigListFill_Click" />

                                <dataInput:Label Grid.Row="1" Grid.Column="1" Tag="{Binding}" Content="{Binding shapeCount}" Style="{StaticResource lblHeaderStyle}"/>

                                <RadioButton GroupName="graphTypeSelectionGroup" Tag="{Binding}" Visibility="{Binding Path=isGraphLayer, Converter={StaticResource ConvertVisibilityFromBool}}" IsChecked="{Binding selectedForGraph, Mode=TwoWay}"  Click="GraphTypeSelection_Click"   ></RadioButton>
                                <dataInput:Label Tag="{Binding}" Content="{Binding layerID}"  Style="{StaticResource LabelStyle}"/>
                                <dataInput:Label Content=":"  Style="{StaticResource LabelStyle}"/>
                                <dataInput:Label Tag="{Binding}" Content="{Binding retrievingCount}" Style="{StaticResource LabelStyle}"/>
                                <dataInput:Label Content=":"  Style="{StaticResource LabelStyle}"/>-->
                            <!--</StackPanel>

                        </layoutToolkit:AccordionItem.Content>
                    </layoutToolkit:AccordionItem>-->

                    <!--<layoutToolkit:AccordionItem Header="Configure Layers"  Style="{StaticResource MenuItemStyle}" IsSelected="False"    >
                        <layoutToolkit:AccordionItem.Content>-->
                            <!-- Configuration Menu Item -->
                            <!--<StackPanel Orientation="Vertical">
                                <Border BorderBrush="Black" BorderThickness="1" Margin="0,2,0,0" Background="Gray" >
                                    <StackPanel Grid.Row="2" Grid.Column="0" Orientation="Horizontal">
                                        <dataInput:Label Style="{StaticResource lblHeaderStyle}" Content="Name" Width="100" />
                                        <dataInput:Label Style="{StaticResource lblHeaderStyle}" Content="Show" Width="40" />
                                        <dataInput:Label Style="{StaticResource lblHeaderStyle}" Content="Fill" Width="40" />
                                        <dataInput:Label Style="{StaticResource lblHeaderStyle}" Content="Zoom Min" Width="75" />
                                        <dataInput:Label Style="{StaticResource lblHeaderStyle}" Content="Zoom Max" Width="75" />
                                        <dataInput:Label Style="{StaticResource lblHeaderStyle}" Content="Color" Width="100" />
                                    </StackPanel>
                                </Border>
                                <ListBox x:Name="lbx_layerConfigList" Margin="0,0,0,0" >
                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <Border BorderBrush="{Binding lineStroke}" BorderThickness="2" >

                                                <Grid>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="auto" />
                                                    </Grid.RowDefinitions>
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="100" />
                                                        <ColumnDefinition Width="40" />
                                                        <ColumnDefinition Width="40" />
                                                        <ColumnDefinition Width="75" />
                                                        <ColumnDefinition Width="75" />
                                                        <ColumnDefinition Width="100" />
                                                    </Grid.ColumnDefinitions>
                                                    <dataInput:Label Grid.Column="0" Tag="{Binding}" Content="{Binding layerName}"                     Style="{StaticResource LabelStyle}"/>
                                                    <CheckBox        Grid.Column="1" Tag="{Binding}" IsChecked="{Binding showLayer, Mode=TwoWay}"           Click="chkBx_lbx_layerConfigListShow_Click" />
                                                    <CheckBox        Grid.Column="2" Tag="{Binding}" IsChecked="{Binding showFill, Mode=TwoWay}"            Click="chkBx_lbx_layerConfigListFill_Click" HorizontalAlignment="Center"/>
                                                    <TextBox         Grid.Column="3" Tag="{Binding}" Text="{Binding minZoomLevel, Mode=TwoWay}"        Style="{StaticResource TxtBxStyle}"  LostFocus ="txtBx_lbx_layerConfigListMinZoom_LostFocus" />
                                                    <TextBox         Grid.Column="4" Tag="{Binding}" Text="{Binding maxZoomLevel, Mode=TwoWay}"        Style="{StaticResource TxtBxStyle}" LostFocus ="txtBx_lbx_layerConfigListMaxZoom_LostFocus" />
                                                    <ComboBox        Grid.Column="5" Tag="{Binding}" ItemsSource="{Binding colorList, Mode=TwoWay}"    SelectedIndex="{Binding SelectedColorIndex, Mode=TwoWay}"   Background="{Binding lineStroke}" SelectionChanged="cmbBx_LayerColor_SelectionChanged" />
                                                </Grid>
                                            </Border>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                </ListBox>
                            </StackPanel>-->
                            <!--<sdk:Label Content=""></sdk:Label>
                        </layoutToolkit:AccordionItem.Content>
                    </layoutToolkit:AccordionItem>-->


                <!--</layoutToolkit:Accordion>-->


                <Border x:Name="BingMapBorder" Grid.Row="0" Grid.Column="2" BorderThickness="2" BorderBrush="Black" Background="{Binding mapBackgroundBrush}">
                    <m:Map CredentialsProvider=""
                x:Name="MyXamlMainMap" 
                Center="{Binding mapCenter, Mode=TwoWay}" 
                ZoomLevel="{Binding mapZoomLevel, Mode=TwoWay}"  
                CopyrightVisibility="Visible" 
                ScaleVisibility="Visible" 
                NavigationVisibility="Visible"
                LogoVisibility="Collapsed"
                ViewChangeEnd="MyMap_ViewChangeEnd"
                MouseClick="MyMap_MouseClick"
                MouseDoubleClick="MyMap_MouseDoubleClick"
                Mode="AerialWithLabels"
                >
            </m:Map>
            </Border>

                <customUI:MiniMap   Grid.Row="0" Grid.Column="2" 
                    x:Name="MyMiniMap" 
                    HorizontalAlignment="Left" 
                    VerticalAlignment="Bottom" 
                    CmdMiniMapMouseClick="{Binding CmdMiniMapMouseClick}"
                    LatLonNW="{Binding mapLatLonNW, Mode=TwoWay}"
                    LatLonSE="{Binding mapLatLonSE, Mode=TwoWay}"
                    ZoomLevel="{Binding miniMapZoomLevel}"
                    Center="{Binding Center, ElementName=MyXamlMainMap}"
                    />
            
                <Image Source="./Images/bing_logo.png"  Grid.Row="0" Grid.Column="2" VerticalAlignment="Bottom" HorizontalAlignment="Right" MaxHeight="20"  ></Image>



                <Button Grid.Row="0" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Top"    Height="20" Content="{Binding leftMenuCommandLabel}"     Command="{Binding CmdToggleShowLeftMenu}"></Button>
            <Button Grid.Row="0" Grid.Column="2"  HorizontalAlignment="Right" VerticalAlignment="Top"    Height="20" Content="{Binding rightMenuCommandLabel}"     Command="{Binding CmdToggleShowRightMenu}"></Button>

            <Grid x:Name="RightMenuGrid" Grid.Row="0" Grid.Column="4"     Visibility="{Binding isRightMenuVisible, Converter={StaticResource ConvertBoolToVisibility}}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="2" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <Grid x:Name="RegionLabelControl" Grid.Row="0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <StackPanel Orientation="Horizontal"  Grid.Row="0" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                        <dataInput:Label Content="Show Labels:"       ></dataInput:Label>
                        <CheckBox IsChecked="{Binding isRegionLabelOn, Mode=TwoWay}" />
                    </StackPanel>

                    <Grid Grid.Row="1" Background="{StaticResource MainPageBackgroundBrush}"  >
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>



                        <StackPanel Orientation="Horizontal"  Grid.Row="0" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Content="Dataset:"       ></dataInput:Label>
                                <dataInput:Label Content="{Binding criteriaDatasetName}"       ></dataInput:Label>
                        </StackPanel>

                        <!--<StackPanel Orientation="Horizontal"  Grid.Row="1" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Content="Data Item:"       ></dataInput:Label>
                            <dataInput:Label Content="{Binding RegionLabel.dataItemHeader}"       ></dataInput:Label>
                        </StackPanel>-->

                        <StackPanel Orientation="Horizontal"  Grid.Row="1" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Content="Choose Display and Format"       ></dataInput:Label>
                        </StackPanel>


                        <ListBox  Grid.Row="2" Grid.Column="0" ItemsSource="{Binding datasetCriteriaList}" Margin="0,0,0,0"   
	                                      Background="{StaticResource MainPageBackgroundBrush}" 
	                                      SelectedIndex="{Binding selectedDatasetCriteriaIndex, Mode=TwoWay}" 
	                                      ItemTemplate="{StaticResource DataTemplateMenuRegionLabels}"
	                                      >
                            <ListBox.ItemsPanel  >
                                <ItemsPanelTemplate>
                                    <StackPanel Orientation="Vertical" Background="{StaticResource MainPageBackgroundBrush}"></StackPanel>
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                        </ListBox>
                    </Grid>
                </Grid>

                <controls:GridSplitter x:Name="RightMenuGridlSplitter" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Background="Blue" Height="4" ToolTipService.ToolTip="Drag to adjust Label/Shading size"></controls:GridSplitter>

                <Grid x:Name="RegionShadingControl" Grid.Row="2">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <StackPanel Orientation="Horizontal"  Grid.Row="0" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                        <dataInput:Label Content="Show Shading:"       ></dataInput:Label>
                        <CheckBox IsChecked="{Binding isRegionFillOn, Mode=TwoWay}" />
                    </StackPanel>

                    <Grid Grid.Row="1" Background="{StaticResource MainPageBackgroundBrush}" >
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>



                        <StackPanel Orientation="Horizontal"  Grid.Row="1" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Content="Dataset:"       ></dataInput:Label>
                                <dataInput:Label Content="{Binding criteriaDatasetName}"       ></dataInput:Label>
                        </StackPanel>

                        <!--<StackPanel Orientation="Horizontal"  Grid.Row="2" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Content="Data Item:"       ></dataInput:Label>
                            <dataInput:Label Content="{Binding RegionFill.dataItemHeader}"       ></dataInput:Label>
                        </StackPanel>-->

                        <StackPanel Orientation="Horizontal"  Grid.Row="2" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Content="Opacity:"       ></dataInput:Label>
                            <Slider Width="100" Minimum="0" Maximum="100" Value="{Binding opacity, Mode=TwoWay}"  />
                            <dataInput:Label Content="{Binding opacity}"       ></dataInput:Label>
                        </StackPanel>

                        <StackPanel Orientation="Horizontal"  Grid.Row="3" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Content="Shading:"  ></dataInput:Label>
                            <customUI:ColorScale   MinBackground="{Binding colorScaleMinBrush}"   MaxBackground="{Binding colorScaleMaxBrush}"  ColorScaleSectionList="{Binding colorScaleSectionList}"  ></customUI:ColorScale>
                        </StackPanel>

                        <!--<StackPanel Orientation="Horizontal"  Grid.Row="4" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Content="Display Criteria"       ></dataInput:Label>
                        </StackPanel>-->




                        <ListBox  x:Name="RegionFillListBox"  Grid.Row="4" Grid.Column="0"
                                ItemsSource="{Binding datasetCriteriaList}" Margin="0,0,0,0"   
                                ItemTemplate="{StaticResource DataTemplateRegionFillCriteria}"
                                Background="{StaticResource MainPageBackgroundBrush}" SelectedIndex="{Binding selectedDatasetCriteriaIndex, Mode=TwoWay}" 
                                VerticalAlignment="Stretch"
                                       >
                            <ListBox.ItemsPanel  >
                                <ItemsPanelTemplate>
                                    <StackPanel Orientation="Vertical" Background="{StaticResource MainPageBackgroundBrush}" ></StackPanel>
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                        </ListBox>

                    </Grid>
                </Grid>


            </Grid>


            <Border x:Name="DataGridBorder" Grid.Row="2" Grid.ColumnSpan="5"   BorderThickness="2" BorderBrush="Black"   Background="{Binding serviceDAL.getDistrictDataSummaryRequestCount, Converter={StaticResource ConvertLoadingBrushFromInt}}"  >
                <Grid x:Name="DataLayoutGrid" Grid.Row="1" Grid.Column="1" Background="Transparent" >
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>


                        <StackPanel Orientation="Vertical"  Grid.Column="0">
                            <dataInput:Label Content="{Binding criteriaDatasetName}"       ></dataInput:Label>

                            <Button Width="50" Height="20" Margin="5" Content="Save" ToolTipService.ToolTip="Save DataGrid to Comma Separated Value (CSV) File"  Command="{Binding CmdFileSaveDataGrid}" ></Button>
                            <RadioButton GroupName="dataGridDisplayType" Content="District"  IsChecked="{Binding dataGridMode, Mode=TwoWay, Converter={StaticResource ConvertEnumToBool}, ConverterParameter=District}"  Margin="3"  />
                            <!--<RadioButton GroupName="dataGridDisplayType" Content="County"    IsChecked="{Binding viewModelBase.dataGridManager.dataGridMode, Mode=TwoWay, Converter={StaticResource ConvertEnumToBool}, ConverterParameter=County}"   Margin="5/>-->
                            <RadioButton GroupName="dataGridDisplayType" Content="Changed"   IsChecked="{Binding dataGridMode, Mode=TwoWay, Converter={StaticResource ConvertEnumToBool}, ConverterParameter=Changed}"   Margin="3"   />
                            <sdk:Label Content="Working"  HorizontalAlignment="Center"  Style="{StaticResource lblHeaderStyle}" />
                            <sdk:Label Content="Pop Dev"  HorizontalAlignment="Center"  Style="{StaticResource lblHeaderStyle}" />
                            <sdk:Label Content="{Binding workingPopulationDeviation }" ToolTipService.ToolTip="Total Population Deviation across all districts that have population" HorizontalAlignment="Center"  Style="{StaticResource lblDataStyle}"  />
                        </StackPanel>

                        <!-- NOTE: Creating columns and binding data is done Programmatically -->
                    <sdk:DataGrid x:Name="districtSummaryDataGrid" Grid.Column="1" 
                                  AutoGenerateColumns="False" 
                                  VerticalScrollBarVisibility="Visible"  
                                  HorizontalScrollBarVisibility="Visible" 
                                  HorizontalAlignment="Stretch" 
                                  VerticalAlignment="Stretch" 
                                  AlternatingRowBackground="LightBlue"
                                  MinHeight="70"
                                  ItemsSource="{Binding districtSummaryDataGridList}"
                                  >
                    </sdk:DataGrid>
                    <!-- //Todo: Need to add a data template for the row data so we can highlight yellow the changed data -->
                </Grid>
            </Border>
            
            <controls:GridSplitter x:Name="MapLeftGridlSplitter" Grid.Row="0" Grid.Column="1"  VerticalAlignment="Stretch" HorizontalAlignment="Center" Background="Blue" ToolTipService.ToolTip="Drag to adjust left side menu size"></controls:GridSplitter>
            <controls:GridSplitter x:Name="MapRightGridlSplitter" Grid.Row="0" Grid.Column="3"  VerticalAlignment="Stretch" HorizontalAlignment="Center" Background="Blue" ToolTipService.ToolTip="Drag to adjust right side size"></controls:GridSplitter>
            <controls:GridSplitter x:Name="grsplSplitter" Grid.Row="1" Grid.ColumnSpan="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" Background="Blue" ToolTipService.ToolTip="Drag to adjust Map/DataGrid size"></controls:GridSplitter>
        </Grid>

        <StackPanel   Grid.Row="2"  Orientation="Horizontal" HorizontalAlignment="Left"   >

        </StackPanel>

        <!-- All popups will be added to this panel programatically -->
        <StackPanel x:Name="ChildwindowStackpanel"  Grid.Row="4" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" ></StackPanel>
        
    </Grid>

</Grid>
</UserControl>
